home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / termio.h.z / termio.h
C/C++ Source or Header  |  1992-04-03  |  7KB  |  289 lines

  1. /* terminal I/O definitions
  2.  *    some System V, some BSD.
  3.  *
  4.  * $Revision: 3.23 $
  5.  */
  6.  
  7.  
  8. #ifndef __TERMIO_H__
  9. #define __TERMIO_H__
  10.  
  11. #define    NCC    8
  12. #define NCC_PAD    7    /* padding in case next version of SV extends NCC */
  13. #define NCC_EXT    16    /* SGI extensions to SVR3 set */
  14. #define NCCS    (NCC+NCC_PAD+NCC_EXT)
  15.  
  16. /* control characters */
  17. #define    VINTR    0
  18. #define    VQUIT    1
  19. #define    VERASE    2
  20. #define    VKILL    3
  21. #define    VEOF    4
  22. #define    VEOL    5
  23. #define    VEOL2    6
  24. #define    VMIN    VEOF
  25. #define    VTIME    VEOL
  26. #define VSWTCH    7
  27.  
  28. #define VLNEXT    (NCC+NCC_PAD+0)    /* take next character literally */
  29. #define VWERASE (NCC+NCC_PAD+1)    /* erase previous word (LDISC1) */
  30. #define VRPRNT    (NCC+NCC_PAD+2)    /* retype the line (LDISC1) */
  31. #define VFLUSHO    (NCC+NCC_PAD+3)    /* flush output (LDISC1) */
  32. #define VSTOP    (NCC+NCC_PAD+4)    /* XOFF */
  33. #define VSTART    (NCC+NCC_PAD+5)    /* XON */
  34.  
  35.  
  36. #define    CNUL    0
  37. #define    CDEL    0377
  38.  
  39. /* default control chars */
  40. #define    CTRL(c)    ('c'&037)
  41. #define    CESC    '\\'        /* LDISC0 'literal next' default */
  42. #define    CINTR    0177        /* DEL */
  43. #define    CQUIT    034        /* FS, cntl-\ */
  44. #define CBRK    0377        /* 4.3BSD compatibility */
  45. #define    CERASE    CTRL(H)
  46. #define    CKILL    CTRL(U)
  47. #define    CEOF    CTRL(d)
  48. #define CEOT    CEOF        /* 4.3BSD compatibility */
  49. #define    CSTART    CTRL(q)
  50. #define    CSTOP    CTRL(s)
  51. #define    CSWTCH    CTRL(z)
  52. #define    CSUSP    CSWTCH        /* 4.3BSD job-control signal */
  53. #define CNSWTCH    0        /* turn off control-Z */
  54.  
  55. /* LDISC1 default control chars */
  56. #define    CLNEXT    CTRL(v)
  57. #define    CWERASE    CTRL(w)
  58. #define    CFLUSHO    CTRL(o)
  59. #define    CFLUSH    CFLUSHO        /* back compatibility */
  60. #define    CRPRNT    CTRL(r)
  61. #define    CDSUSP    CTRL(y)        /* delayed job-control (not implemented yet) */
  62.  
  63.  
  64. /* input modes */
  65. #define    IGNBRK    0000001
  66. #define    BRKINT    0000002
  67. #define    IGNPAR    0000004
  68. #define    PARMRK    0000010
  69. #define    INPCK    0000020
  70. #define    ISTRIP    0000040
  71. #define    INLCR    0000100
  72. #define    IGNCR    0000200
  73. #define    ICRNL    0000400
  74. #define    IUCLC    0001000
  75. #define    IXON    0002000
  76. #define    IXANY    0004000
  77. #define    IXOFF    0010000
  78. #define    IBLKMD    0020000
  79.  
  80. /* output modes */
  81. #define    OPOST    0000001
  82. #define    OLCUC    0000002
  83. #define    ONLCR    0000004
  84. #define    OCRNL    0000010
  85. #define    ONOCR    0000020
  86. #define    ONLRET    0000040
  87. #define    OFILL    0000100
  88. #define    OFDEL    0000200
  89. #define    NLDLY    0000400
  90. #define    NL0    0
  91. #define    NL1    0000400
  92. #define    CRDLY    0003000
  93. #define    CR0    0
  94. #define    CR1    0001000
  95. #define    CR2    0002000
  96. #define    CR3    0003000
  97. #define    TABDLY    0014000
  98. #define    TAB0    0
  99. #define    TAB1    0004000
  100. #define    TAB2    0010000
  101. #define    TAB3    0014000
  102. #define    BSDLY    0020000
  103. #define    BS0    0
  104. #define    BS1    0020000
  105. #define    VTDLY    0040000
  106. #define    VT0    0
  107. #define    VT1    0040000
  108. #define    FFDLY    0100000
  109. #define    FF0    0
  110. #define    FF1    0100000
  111.  
  112. /* control modes */
  113. #define    CBAUD    0000017
  114. #define    B0    0
  115. #define    B50    0000001        /* not supported */
  116. #define    B75    0000002
  117. #define    B110    0000003
  118. #define    B134    0000004
  119. #define    B150    0000005
  120. #define    B200    0000006        /* not supported */
  121. #define    B300    0000007
  122. #define    B600    0000010
  123. #define    B1200    0000011
  124. #define    B1800    0000012        /* not supported */
  125. #define    B2400    0000013
  126. #define    B4800    0000014
  127. #define    B9600    0000015
  128. #define    B19200    0000016
  129. #define    EXTA    0000016
  130. #define    B38400    0000017
  131. #define    EXTB    0000017
  132. #define    CSIZE    0000060
  133. #define    CS5    0
  134. #define    CS6    0000020
  135. #define    CS7    0000040
  136. #define    CS8    0000060
  137. #define    CSTOPB    0000100
  138. #define    CREAD    0000200
  139. #define    PARENB    0000400
  140. #define    PARODD    0001000
  141. #define    HUPCL    0002000
  142. #define    CLOCAL    0004000
  143. #ifdef SVR3
  144. /* #define RCV1EN    0010000 */
  145. /* #define XMT1EN    0020000 */
  146. #endif
  147. #define LOBLK    0040000
  148.  
  149. /* line discipline 0 modes in lflag */
  150. #define    ISIG    0000001
  151. #define    ICANON    0000002
  152. #define    XCASE    0000004
  153. #define    ECHO    0000010
  154. #define    ECHOE    0000020
  155. #define    ECHOK    0000040
  156. #define    ECHONL    0000100
  157. #define    NOFLSH    0000200
  158. #define IIEXTEN    0000400        /* !!!!!!NOT YET IMPLEMENTED!!!!!!! */
  159. #define ITOSTOP    0001000
  160.  
  161. #define    SSPEED    B9600
  162.  
  163.  
  164. #if defined SVR3 || !defined _KERNEL
  165. # include <sys/ioctl.h>
  166. #else
  167. # include "../h/ioctl.h"
  168. #endif
  169.  
  170. typedef unsigned short    tcflag_t;
  171. typedef unsigned char    cc_t;
  172.  
  173. /*
  174.  * Ioctl control packet
  175.  * Note that this structure is identical with "struct termios"
  176.  * defined in <termios.h> - should there be need to change
  177.  * one or the other, the POSIX compatibility functions
  178.  * tcgetattr and tcsetattr (at least) will have to be
  179.  * changed.
  180.  */
  181. struct termio {
  182.     tcflag_t    c_iflag;    /* input modes */
  183.     tcflag_t    c_oflag;    /* output modes */
  184.     tcflag_t    c_cflag;    /* control modes */
  185.     tcflag_t    c_lflag;    /* line discipline modes */
  186.     char        c_line;        /* line discipline */
  187.     cc_t        c_cc[NCCS];    /* control chars */
  188. };
  189. #define    IOCTYPE    0xff00
  190.  
  191. #define    TIOC    ('T'<<8)
  192. #define    oTCGETA     (TIOC|1)    /* old versions */
  193. #define    oTCSETA     (TIOC|2)
  194. #define    oTCSETAW (TIOC|3)
  195. #define    oTCSETAF (TIOC|4)
  196. #define    TCSBRK    (TIOC|5)
  197. #define    TCXONC    (TIOC|6)
  198. #define    TCFLSH    (TIOC|7)
  199. #define    TCGETA    (TIOC|8)
  200. #define    TCSETA    (TIOC|9)
  201. #define    TCSETAW    (TIOC|10)
  202. #define    TCSETAF    (TIOC|11)
  203. #define TIOCFLUSH    (TIOC|12)
  204. #ifdef    TRUSTEDIRIX
  205. #define TCSETLABEL    (TIOC|13)    /* set device label */
  206. #endif    /* TRUSTEDIRIX */
  207. #define    TCDSET    (TIOC|32)
  208. #define    TCBLKMD    (TIOC|33)
  209. #define    TIOCPKT        (TIOC|112)    /* pty: set/clear packet mode */
  210. #define        TIOCPKT_DATA        0x00    /* data packet */
  211. #define        TIOCPKT_FLUSHREAD    0x01    /* flush packet */
  212. #define        TIOCPKT_FLUSHWRITE    0x02    /* flush packet */
  213. /* not supported #define TIOCPKT_STOP        0x04 */    /* stop output */
  214. /* not supported #define TIOCPKT_START        0x08 */    /* start output */
  215. #define        TIOCPKT_NOSTOP        0x10    /* no more ^S, ^Q */
  216. #define        TIOCPKT_DOSTOP        0x20    /* now do ^S ^Q */
  217. #define TIOCNOTTY (TIOC|113)        /* disconnect from tty & pgrp */
  218. #define TIOCSTI    (TIOC|114)        /* simulate terminal input */
  219.  
  220. #define    TIOCSPGRP    _IOW('t', 118, int)    /* set pgrp of tty */
  221. #define    TIOCGPGRP    _IOR('t', 119, int)    /* get pgrp of tty */
  222. #define    TIOCCONS    _IOW('t', 120, int)    /* make this the console */
  223.  
  224. /*
  225.  * Window size structure
  226.  */
  227. struct winsize {
  228.     unsigned short    ws_row, ws_col;        /* character size of window */
  229.     unsigned short    ws_xpixel, ws_ypixel;    /* pixel size of window */
  230. };
  231.  
  232. #define TIOCGWINSZ    _IOR('t', 104, struct winsize)    /* get window size */
  233. #define TIOCSWINSZ    _IOW('t', 103, struct winsize)    /* set window size */
  234.  
  235. #define    TFIOC    ('F'<<8)
  236. #define oFIONREAD (TFIOC|127)        /* pre-3.5 value of FIONREAD */
  237.  
  238.  
  239. #define    LDIOC    ('D'<<8)
  240. #define    LDOPEN    (LDIOC|0)
  241. #define    LDCLOSE    (LDIOC|1)
  242. #define    LDCHG    (LDIOC|2)
  243. #define    LDGETT    (LDIOC|8)
  244. #define    LDSETT    (LDIOC|9)
  245.  
  246. /*
  247.  * Terminal types
  248.  */
  249. #define    TERM_NONE    0    /* tty */
  250. #define    TERM_TEC    1    /* TEC Scope */
  251. #define    TERM_V61    2    /* DEC VT61 */
  252. #define    TERM_V10    3    /* DEC VT100 */
  253. #define    TERM_TEX    4    /* Tektronix 4023 */
  254. #define    TERM_D40    5    /* TTY Mod 40/1 */
  255. #define    TERM_H45    6    /* Hewlitt-Packard 45 */
  256. #define    TERM_D42    7    /* TTY Mod 40/2B */
  257.  
  258. /*
  259.  * Terminal flags
  260.  */
  261. #define TM_NONE        0000    /* use default flags */
  262. #define TM_SNL        0001    /* special newline flag */
  263. #define TM_ANL        0002    /* auto newline on column 80 */
  264. #define TM_LCF        0004    /* last col of last row special */
  265. #define TM_CECHO    0010    /* echo terminal cursor control */
  266. #define TM_CINVIS    0020    /* do not send esc seq to user */
  267. #define TM_SET        0200    /* must be on to set/res flags */
  268.  
  269. /*
  270.  * Line Disciplines
  271.  */
  272. #define LDISC0    0            /* ancient, standard */
  273. #define LDISC1    1            /* new, 4.3BSD-like in streams */
  274. #define NTTYDISC LDISC1            /* compatibility for BSD programs */
  275.  
  276. /*
  277.  * structure of ioctl arg for LDGETT and LDSETT
  278.  *    This structure is no longer used.
  279.  */
  280. struct    termcb    {
  281.     char    st_flgs;    /* term flags */
  282.     char    st_termt;    /* term type */
  283.     char    st_crow;    /* gtty only - current row */
  284.     char    st_ccol;    /* gtty only - current col */
  285.     char    st_vrow;    /* variable row */
  286.     char    st_lrow;    /* last row */
  287. };
  288. #endif
  289.